<?php 
session_start();
require_once(ABSPATH . 'wp-admin/includes/user.php');
require_once(ABSPATH . WPINC . '/registration.php');
require_once dirname( __FILE__ ) . '/functions-clientuser.php';
?>


<!-- Trieu: hoan thanh hien thi bai viet nhung avatar chua hoan thanh, layout con bi vo -->

<?php get_header();?>

<?php
	/*global $post;
	setup_postdata($post);*/
	the_post(); // Bat buot phai co de setupdata post de query cac du lieu cua bai posts
?>

<div id="content">
	
	<div class="left">
		<?php require_once 'searchform.php';?>
        	<div class="question">
        		<div class="question-title">
            		<div class="question-user-img">
            			<!-- Lay avatar cua user -->
                		<?php echo get_avatar($user_ID, 32, get_bloginfo('template_directory')."/images/no_avatar.gif")?>
                	</div>
                	<div class="question-by">
                		<p><?php the_author()?></p>
                    	<p class="question-h1"><?php the_title();?></p>
                	</div>
                    
                	<div style="clear:both;"></div>
            	</div>
             <div class="question-content">
             	<p>
             		<?php  echo the_content();?>
             	</p>
             </div>
            <div class="question-bottom">
            	<div class="answer">
            		<?php if($user_ID):?>
                		<a href="#ANSWER_THIS_QUESTION">Answer this question</a> <!-- Neu da dang nhap tu dong nhay den phan answer -->
                	<?php else:?>
                		<a href="#LOGIN" onmouseup="alert('Sory, You must login to answer this question!')">
                			Answer this question
                		</a>
                	<?php endif;?>
                </div>
                <div class="answers">
                	<p>
                	<!-- Dem so comment, co 3 truong hop 0, 1 va nhieu comment -->
                		<?php comments_number('No Answer',
                			 '<font class="answer-nr">1</font> Answer',
                			 '<font class="answer-nr">%</font> Answers');?>
                	</p>
                </div>
                <div class="answer-date">
                	<p><?php the_time('F jS, Y');?></p>
                </div>
			</div>
         </div>
     	
        <div class="answers-nr">
        	<p><?php comments_number('No Answer', '1 Answer', '% Answers');?></p>
        </div>
        
       <?php comments_template()?> <!-- View comments va add comment, add vao file comments.php -->
        
        
    </div>  
    <?php get_sidebar();?>
    <div style="clear:both;"></div>
</div>

<?php get_footer();?>